//实际项目api接口请求数据开发
// 1.下载axiosutils/request.js中创建axios实例并导出
// 2.src/api
// 3.组件中或pinia中调用api


// 1导入axios
import axios from 'axios'

// 2创建实例
const instance = axios.create({
    baseURL: 'http://123.56.141.187:81/fsdy/',
    timeout: 5000,
})

//3创建拦截器 
instance.interceptors.request.use(config => {
    // Do something before request is sent
    return config;
}, error => {
    // Do something with request error
    return Promise.reject(error);
});

instance.interceptors.response.use(response => {
    // Do something before response is sent
    return response.data;
}, error => {
    // Do something with response error
    return Promise.reject(error);
});

export default instance